package com.liyuxiang.yygh.task.scheduled;

import com.liyuxiang.common.rabbit.constant.MqConst;
import com.liyuxiang.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    RabbitService rabbitService;

    //每天8点提醒就医
    //cron表达式，设置执行间隔
    @Scheduled(cron = "0 20 9 * * ? ")
    public void taskPatient() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");
    }
}
